<template>
	<img
		class="headimg-container"
		:src="url"
		:style="{ width: size + 'px', height: size + 'px' }"
	/>
</template>

<script>
//默认头像
import headimgUrl from "@/assets/images/head.png";
// 头像组件
export default {
	props: {
		url: {
			type: String, //类型为字符串
			required: true, //必填
			default: headimgUrl,
		},
		size: {
			type: Number, //类型为数字
			default: 100, //默认值
		},
	},
};
</script>

<style scoped>
/* 样式作用于当前组件 */
.headimg-container {
	display: block;
	border-radius: 50%;
	object-fit: cover;
}
</style>
